<template>
  <div class="head-container">
    <!-- 搜索 -->
    <el-input v-model="query.catName" clearable placeholder="输入分类名称搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <!-- <el-select v-model="companyType" placeholder="请选择公司类型" style="width: 360px;" @change="changeType">
      <el-option
        v-for="(item, i) in permissions"
        :key="i"
        :label="item.dictName"
        :value="item.dictNo"/>
    </el-select> -->
    <el-button class="filter-item" size="mini" type="primary" icon="el-icon-search" @click="toQuery">搜索</el-button>
    <!-- 新增 -->
    <div style="display: inline-block;margin: 0px 2px;">
      <el-button
        class="filter-item"
        size="mini"
        type="primary"
        icon="el-icon-plus"
        @click="$refs.form.dialog = true">新增</el-button>
      <eForm ref="form" :permissions="permissions" :company-levels="companyLevels" :is-add="true"/>
    </div>
  </div>
</template>

<script>
import checkPermission from '@/utils/permission'
import eForm from './form'
export default {
  components: { eForm },
  props: {
    query: {
      type: Object,
      required: true
    },
    permissions: {
      type: Array,
      required: true
    },
    companyLevels: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      downloadLoading: false,
      companyType: ""
    }
  },
  methods: {
    checkPermission,
    toQuery() {
      console.log(this.query)
      this.$parent.page = 0
      this.$parent.init()
    },
    changeType(e) {
      this.query.companyType = e
      // this.toQuery()
    }
  }
}
</script>
